<?php 
/**
 * 身份认证操作
 * 
 */
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/datalistcp.class.php");
CheckRank(0,0);
$menutype = 'mydede';
$menutype_son = 'smlb';
setcookie("ENV_GOBACK_URL",GetCurUrl(),time()+3600,"/");
if(!isset($dopost)) $dopost = '';

/**
 *  获取状态
 *
 * @param     string  $sta  状态ID
 * @return    string
 */
if($cfg_ml->isAdmin!=1){
	ShowMsg('对不起，你没权限访问该页面！','-1');
    exit();
}
 
if($dopost=='')
{
    $sql = "SELECT h.*,s.* FROM `#@__member_certification` h 
	left join `#@__member` s on s.mid=h.mid
	ORDER BY h.utime DESC";
}
else if($dopost=='search')
{
    $sql = "SELECT h.*,s.* FROM `#@__member_certification` h 
	left join `#@__member` s on s.mid=h.mid
	WHERE s.userid='$k' ORDER BY h.utime DESC";
}
else if($dopost=='read')
{
    $sql = "SELECT h.*,s.* FROM `#@__member_certification` h 
	left join `#@__member` s on s.mid=h.mid
	WHERE h.mid='$id' ORDER BY h.utime DESC";

    $row = $dsql->GetOne("SELECT * FROM `#@__member_certification` WHERE mid='$id'");
    if(!is_array($row))
    {
        ShowMsg('对不起，你指定的消息不存在或你没权限查看！','-1');
        exit();
    }
	else
	{
		if($row['sta']==0 || $row['sta']==1){
			$row['sta'] = '<font color=red>未审核</font>';
		}else if($row['sta']==2){
			$row['sta'] = '<font color=red>被拒绝</font>';
		}else{
			$row['sta'] = '已通过';
		}
	}
}
else if($dopost=='rzcl')
{
	if($cz=='tg')
	{
		$dsql->ExecuteNoneQuery("UPDATE `#@__member_certification` SET sta=3, jjyy='' WHERE mid='$rzid'");
		$dsql->ExecuteNoneQuery("UPDATE `#@__member` SET certification=3 WHERE mid='$rzid'");
		if($pid!=''){
			$dsql->ExecuteNoneQuery("UPDATE `#@__member_pms` SET rzcl=3 WHERE id='$pid'");
		}else{
			ShowMsg('请在短消息详情中处理认证信息！','rzlist.php',0,8);
			exit();
		}
		ShowMsg('处理成功，处理结果“通过”！','rzlist.php',0,8);
		exit();
	}
	else if($cz=='btg')
	{
		$dsql->ExecuteNoneQuery("UPDATE `#@__member_certification` SET sta=2, jjyy='$btgcont' WHERE mid='$rzid'");
		$dsql->ExecuteNoneQuery("UPDATE `#@__member` SET certification=2 WHERE mid='$rzid'");
		if($pid!=''){
			$dsql->ExecuteNoneQuery("UPDATE `#@__member_pms` SET rzcl=2 WHERE id='$pid'");
		}else{
			ShowMsg('请在短消息详情中处理认证信息！','rzlist.php',0,8);
			exit();
		}
		ShowMsg('处理成功，处理结果“不通过”！','rzlist.php',0,8);
		exit();
	}
}
$dlist = new DataListCP();
$dlist->pageSize = 30;
$dlist->SetTemplate(DEDEMEMBER."/templets/rzlist.htm");    
$dlist->SetSource($sql);
$dlist->Display(); 